<script setup lang="ts">
import { defineAsyncComponent, type Component } from 'vue'
import {
  __federation_method_getRemote,
  __federation_method_unwrapDefault,
} from 'virtual:__federation__'

const props = defineProps<{
  remote: string
  name: string
}>()

const com = defineAsyncComponent(async () => {
  const module = await __federation_method_getRemote(props.remote, `./${props.name}`)
  return __federation_method_unwrapDefault(module) as Component
})
</script>

<template>
  <component :is="com" v-bind="$attrs"></component>
</template>
